export const getLabel = (data, key) => {
    if (!data || !data.length) {
        return ''
    }
    let cur = data.find(item => item.value === key)
    return cur && cur.label ? cur.label : ''
}

export const getValue = (data, key) => {
    if (!data || !data.length) {
        return ''
    }
    let cur = data.find(item => item.label === key)
    return cur && cur.value ? cur.value : ''
}

export const isWechatOfficialAccount = () => {
    var userAgent = window.navigator.userAgent.toLowerCase();
    if (userAgent.match(/MicroMessenger/i) == 'micromessenger') {
      // 是微信公众号环境
      return true;
    } else {
      // 不是微信公众号环境
      return false;
    }
  }